Any selected or dropped files have been passed in one variable called
allents, each filename is surrounded by quotes and separated by a space.
This routine separates allents into individual entries and gets it's type,
for example:
allents = "foo" "bar" "why"
file file dir
will become:
name.1 = "foo" type.1 = -1
name.2 = "bar" type.2 = -1
name.3 = "why" type.3 = 1
1getall:
2 entries = 0
3 do while allents ~= ''
4 entries = entries + 1
5 parse var allents '"' name.entries '"' allents
6 if name.entries = '' then
7 type.entries = 1
8 else do
9 lister query handle entry '"'name.entries'"' stem fileinfo.
10 type.entries = fileinfo.type
11 end
12 end
13 return
Line:
1 Sub-routine label.
2 Set variable entries to 0.
3 Loop while allents isn't an empty string.
4 Increment variable entries.
5 One of the many wonders of ARexx, here we parse variable allents,
extracting the first filename into name.entries and returning the
rest of the string back to variable allents.
Example: allents = "foo.zip" "bar.zip" "now.zip"
After: parse var allents '"' name.entries '"' allents
allents = "bar.zip" "now.zip"
name.entries = "foo.zip"
6 - 7 We had an entry with an empty string for a name in which case we
assume it's a directory and set it's type to 1.
8 - 11 Otherwise we do a lister query entry on it and get it's entry type.
12 Loop around.
13 We return to the calling function.
|